Real time video processing for changing proportions of an object in the video

ABSTRACT

Method involving: providing an object in the video that at least partially and at least occasionally is presented in frames of a video; detecting the object in the video, wherein said detection comprises detecting feature reference points of the object; tracking the detected object in the video, wherein the tracking comprises creating a mesh that is based on the detected feature reference points of the object and aligning the mesh to the object in each frame; generating a first set of node points on the created mesh based on a request for changing proportions; generating a second set of node points based on the first set of node points; and transforming the frames of the video in such way that the object&#39;s proportions are transformed in accordance with the second set of the node points using the mesh.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of priority of U.S. patent application Ser. No. 16/749,708, filed on Jan. 22, 2020, which is a continuation of and claims the benefit of priority of U.S. patent application Ser. No. 14/314,312, filed on Jun. 25, 2014, which claims the benefit of U.S. Provisional Application No. 61/936,016, filed on Feb. 5, 2014, which are hereby incorporated by reference herein in their entirety.

BACKGROUND OF THE INVENTION Technical Field

The disclosed embodiments relate generally to the field of real time video processing, in particular, to a system and method of real time video processing for changing proportions of an object in the video.

Description of the Related Art

Nowadays a variety of devices and programs can provide processing of still images, for example effects like face thinning, makeup, etc, and processing of real time video using some filters (for example, web cam video). Also some face tracking algorithms and implementations for video streams or video data are known.

In particular, some programs can change an object in a video stream, for example, change a person's face by changing proportions of a whole frame or overlaying any extra objects on a person's face. However, there are no programs that can implement changes to an object in a video stream that seem to be natural and cannot be recognized with the naked eye. Further, such programs cannot be implemented in real time by mobile devices, since they are resource-intensive and such devices cannot handle such operations for changing an object in real time.

U.S. Patent Application Publication No. US2007268312, incorporated herein by reference, discloses a method of replacing face elements by some components that is made by users as applied to real time video. This method involves changing of an object in a video stream by overlaying it with new predetermined images. However, it is not possible to process real time video such that an object shown in real time video can be modified in real time naturally with some effects. In case of a human's face such effects can include making a face fatter/thinner as well as other distortions.

Thus, new and improved systems and methods are needed that would enable real time video processing for changing proportions of an object in the video.

SUMMARY OF THE INVENTION

The embodiments described herein are directed to systems and methods that substantially obviate one or more of the above and other problems associated with the conventional technology for real time video processing.

In accordance with one aspect of the embodiments described herein, there is provided a computer-implemented method for real time video processing for changing proportions of an object in the video, the method involving: providing an object in the video that at least partially and at least occasionally is presented in frames of a video; detecting the object in the video, wherein said detection comprises detecting feature reference points of the object; tracking the detected object in the video, wherein the tracking comprises creating a mesh that is based on the detected feature reference points of the object and aligning the mesh to the object in each frame; generating a first set of node points on the created mesh based on a request for changing proportions; generating a second set of node points based on the first set of node points; and transforming the frames of the video in such way that the object's proportions are transformed in accordance with the second set of the node points using the mesh.

In one or more embodiments, the computer-implemented method further comprises creating a square grid associated with a background of the object in the video; and transforming the background of the object using the square grid to avoid the background distortion.

In one or more embodiments, the object in the video to be detected is a human face.

In one or more embodiments, the object's feature reference points are at least one of the points indicating eyebrows vertical position, eyes vertical position, eyes width, eyes height, eye separation distance, nose vertical position, nose pointing up, mouth vertical position, mouth width, chin width, upper lip raiser, jaw drop, lip stretcher, left brow lowerer, right brow lowerer, lip corner depressor, and outer brow raiser.

In one or more embodiments, the method further comprises: indicating a presence of an object from a list of objects in frames of the video, wherein the list further comprises rules for changing proportions of each object from the list; and generating a request for changing proportions of the object which presence in frames of the video is indicated.

In one or more embodiments, the method further comprises: defining an object to be changed in frames of the video and rules for changing proportions of the object by a user; and generating a request for changing proportions of the object defined by the user.

In one or more embodiments, the method further comprises: defining by a user a frame area of the video to be processed, wherein the frame area to be processed sets a frame area of the video such that only proportions of those objects or their parts which are positioned in the frame area to be processed are changed.

In one or more embodiments, the method further comprises: randomly selecting at least one object to be changed in frames of the video out of the objects in frames of the video and randomly selecting at least one rule for changing proportions of the selected object out of a list of rules; and generating a request for changing proportions of the randomly selected object based on the randomly selected rules.

In one or more embodiments, the detecting of the object in the video is implemented with the use of Viola-Jones method.

In one or more embodiments, the detecting of the object's feature points is implemented with the use of an Active Shape Model (ASM).

In one or more embodiments, the processed video comprises a video stream.

In accordance with another aspect of the embodiments described herein, there is provided a mobile computerized system comprising a central processing unit and a memory, the memory storing instructions for: providing an object in the video that at least partially and at least occasionally is presented in frames of a video; detecting the object in the video, wherein said detection comprises detecting feature reference points of the object; tracking the detected object in the video, wherein the tracking comprises creating a mesh that is based on the detected feature reference points of the object and aligning the mesh to the object in each frame; generating a first set of node points on the created mesh based on a request for changing proportions; generating a second set of node points based on the first set of node points; and transforming the frames of the video in such way that the object's proportions are transformed in accordance with the second set of the node points using the mesh.

In one or more embodiments, the memory further stores instructions for creating a square grid associated with a background of the object in the video; and transforming the background of the object using the square grid to avoid the background distortion.

In one or more embodiments, the object in the video to be detected is a human face.

In one or more embodiments, the object's feature reference points are at least one of the points indicating eyebrows vertical position, eyes vertical position, eyes width, eyes height, eye separation distance, nose vertical position, nose pointing up, mouth vertical position, mouth width, chin width, upper lip raiser, jaw drop, lip stretcher, left brow lowerer, right brow lowerer, lip corner depressor, and outer brow raiser.

In one or more embodiments, the memory storing further instructions for: indicating a presence of an object from a list of objects in frames of the video, wherein the list further comprises rules for changing proportions of each object from the list; and generating a request for changing proportions of the object which presence in frames of the video is indicated.

In one or more embodiments, the memory storing further instructions for: defining an object to be changed in frames of the video and rules for changing proportions of the object by a user; and generating a request for changing proportions of the object defined by the user.

In one or more embodiments, the memory storing further instructions for: defining by a user a frame area of the video to be processed, wherein the frame area to be processed sets a frame area of the video such that only proportions of those objects or their parts which are positioned in the frame area to be processed are changed.

In one or more embodiments, the memory storing further instructions for: randomly selecting at least one object to be changed in frames of the video out of the objects in frames of the video and randomly selecting at least one rule for changing proportions of the selected object out of a list of rules; and generating a request for changing proportions of the randomly selected object based on the randomly selected rules.

In one or more embodiments, the detecting of the object in the video is implemented with the use of Viola-Jones method.

In one or more embodiments, the detecting of the object's feature points is implemented with the use of an Active Shape Model (ASM).

Additional aspects related to the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Aspects of the invention may be realized and attained by means of the elements and combinations of various elements and aspects particularly pointed out in the following detailed description and the appended claims.

It is to be understood that both the foregoing and the following descriptions are exemplary and explanatory only and are not intended to limit the claimed invention or application thereof in any manner whatsoever.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute a part of this specification exemplify the embodiments of the present invention and, together with the description, serve to explain and illustrate principles of the inventive technique. Specifically:

FIG. 1 illustrates facial feature points detected by an ASM algorithm used in the method according to one embodiment of the present invention.

FIG. 2 illustrates Candide-3 model used in the method according to one embodiment of the present invention.

FIG. 3(a)-3(b) show an example of a mean face (a) and an example of current observation.

FIG. 4 illustrates Candide at a frame used in the method according to one embodiment of the present invention.

FIG. 5 shows an example of the square grid used in the method according to one embodiment of the present invention.

FIG. 6 illustrates a set of control points p.

FIG. 7 illustrates the difference between points' of p and q positions.

FIG. 8(a)-8(c) show an example of a normal face (a), a thin face with a thin nose provided by the method according to the present invention (b) and a fat face with a fat nose provided by the method according to the present invention (c).

FIG. 9 illustrates an exemplary embodiment of a computer platform based on which the techniques described herein may be implemented.

DETAILED DESCRIPTION

In the following detailed description, reference will be made to the accompanying drawing(s), in which identical functional elements are designated with like numerals. The aforementioned accompanying drawings show by way of illustration, and not by way of limitation, specific embodiments and implementations consistent with principles of the present invention. These implementations are described in sufficient detail to enable those skilled in the art to practice the invention and it is to be understood that other implementations may be utilized and that structural changes and/or substitutions of various elements may be made without departing from the scope and spirit of present invention. The following detailed description is, therefore, not to be construed in a limited sense. Additionally, the various embodiments of the invention as described may be implemented in the form of a software running on a general purpose computer, in the form of a specialized hardware, or combination of software and hardware.

It will be appreciated that the method for real time video processing can be performed with any kind of video data, e.g. video streams, video files saved in a memory of a computerized system of any kind (such as mobile computer devices, desktop computer devices and others), and all other possible types of video data understandable for those skilled in the art. Any kind of video data can be processed, and the embodiments disclosed herein are not intended to be limiting the scope of the present invention by indicating a certain type of video data.

According to one aspect, the automatic real time video processing of the present invention is aimed to detecting person face in the video and changing its proportions. However, it is obvious for one skilled in the art that proportions of other objects in video can be changed using the present method.

One embodiment described herein provides an automatic detection of a face in real time video and changing its proportions in said video to make the face thinner or thicker to the selected grade.

In one or more embodiments, the method of real time video processing for changing proportions of an object in the video involves face detection and a 6D head position estimation, in which yaw, pitch, roll, x, y, size are estimated. As human faces and heads may have different properties, such as eyes distance, head height etc, they are estimated from the first frame and don't change during a video processing. Positions of eyebrows, lips and yaw are also estimated at each frame, as they can move independently because of human gesture.

In one or more embodiments, the method uses tracked information to achieve changing of proportions. A video can be processed frame-by-frame, with no dependence between consequent frames or information about some previous frames can be used.

In addition, computation on the GPU is used to increase performance.

The embodiments disclosed further are aimed for processing of video streams, however all other types of video data including video files saved in a memory of a computerized system can be processed by the methods of the present invention. For example, a user can load video files and save them in a memory of his computerized system and such video files can be also processed by the methods of the present invention. According to one of the preferred embodiments the method of real time video stream processing for changing proportions of an object in the video stream comprises: providing an object in the video stream that at least partially and at least occasionally is presented in frames of a video stream; detecting the object in the video stream, wherein said detection comprises detecting feature reference points of the object; tracking the detected object in the video stream, wherein the tracking comprises creating a mesh that is based on the detected feature reference points of the object and aligning the mesh to the object in each frame; generating a first set of node points on the created mesh based on a request for changing proportions; generating a second set of node points based on the first set of node points; and transforming the frames of the video stream in such way that the object's proportions are transformed in accordance with the second set of the node points using the mesh.

According to one of the embodiments the computer implemented method of claim 1 includes further creating a square grid associated with a background of the object in the video stream; and transforming the background of the object using the square grid to avoid the background distortion.

One of the objects to be processed is a human face. In this case object's feature reference points for a human's face are at least one of the points indicating eyebrows vertical position, eyes vertical position, eyes width, eyes height, eye separation distance, nose vertical position, nose pointing up, mouth vertical position, mouth width, chin width, upper lip raiser, jaw drop, lip stretcher, left brow lowerer, right brow lowerer, lip corner depressor, and outer brow raiser.

According to one of the embodiments the method further comprises indicating a presence of an object from a list of objects in frames of the video stream, wherein the list further comprises rules for changing proportions of each object from the list; and generating a request for changing proportions of the object which presence in frames of the video stream is indicated.

According to another embodiment the method further includes defining an object to be changed in frames of the video stream and rules for changing proportions of the object by a user; and generating a request for changing proportions of the object defined by the user. In this case the method xan further include defining by a user a frame area of the video stream to be processed, wherein the frame area to be processed sets a frame area of the video stream such that only proportions of those objects or their parts which are positioned in the frame area to be processed are changed.

According to yet another embodiment the method further includes randomly selecting at least one object to be changed in frames of the video stream out of the objects in frames of the video stream and randomly selecting at least one rule for changing proportions of the selected object out of a list of rules; and generating a request for changing proportions of the randomly selected object based on the randomly selected rules.

Face Detection and Initialization

In one or more embodiments, first, in the algorithm for changing proportion a user sends a request for changing proportions of an object in a video stream. The next step in the algorithm involves detecting the object in the video stream.

In one or more embodiments, the face is detected on an image with the use of Viola-Jones method. Viola-Jones method is a fast and quite accurate method used to detect the face region. Then, an Active Shape Model (ASM) algorithm is applied to the face region of an image to detect facial feature points. However, it should be appreciated that other methods and algorithms suitable for face detection can be used.

In one or more embodiments, for locating facial features locating of landmarks is used. A landmark represents a distinguishable point present in most of the images under consideration, for example, the location of the left eye pupil (FIG. 1 ).

In one or more embodiments, a set of landmarks forms a shape. Shapes are represented as vectors: all the x- followed by all the y-coordinates of the points in the shape. One shape is aligned to another with a similarity transform (allowing translation, scaling, and rotation) that minimizes the average Euclidean distance between shape points. The mean shape is the mean of the aligned training shapes (which in the present disclosure are manually landmarked faces).

Subsequently, in accordance with the ASM algorithm, the search for landmarks from the mean shape aligned to the position and size of the face determined by a global face detector is started. It then repeats the following two steps until convergence (i) suggest a tentative shape by adjusting the locations of shape points by template matching of the image texture around each point (ii) conform the tentative shape to a global shape model. The individual template matches are unreliable and the shape model pools the results of the weak template matchers to form a stronger overall classifier. The entire search is repeated at each level in an image pyramid, from coarse to fine resolution. It follows that two types of submodel make up the ASM: the profile model and the shape model.

In one or more embodiments, the profile models (one for each landmark at each pyramid level) are used to locate the approximate position of each landmark by template matching. Any template matcher can be used, but the classical ASM forms a fixed-length normalized gradient vector (called the profile) by sampling the image along a line (called the whisker) orthogonal to the shape boundary at the landmark. During training on manually landmarked faces, at each landmark the mean profile vector g and the profile covariance matrix Sg are calculated. During searching, the landmark along the whisker to the pixel whose profile g has lowest Mahalanobis distance from the mean profile g is displaced, where the

MahalanobisDistance=(g−g )^(T) S _(g) ⁻¹(g−g ).  (1)

In one or more embodiments, the shape model specifies allowable constellations of landmarks. It generates a shape {circumflex over (x)} with

{circumflex over (x)}=x+Φb  (2)

where {circumflex over (x)} is the mean shape, b is a parameter vector, and Φ is a matrix of selected eigenvectors of the covariance matrix Sg of the points of the aligned training shapes. Using a standard principal components approach model has as much variation in the training set as it is desired by ordering the eigenvalues λi of Ss and keeping an appropriate number of the corresponding eigenvectors in Φ. In the method is used a single shape model for the entire ASM but it is scaled for each pyramid level.

Subsequently, the Equation 2 is used to generate various shapes by varying the vector parameter b. By keeping the elements of b within limits (determined during model building) it is possible to ensure that generated face shapes are lifelike.

Conversely, given a suggested shape x, it is possible to calculate the parameter b that allows Equation 2 to best approximate x with a model shape x{circumflex over ( )}. An iterative algorithm, described by Cootes and Taylor, that gives the b and T that minimizes

distance(x,T( x+Φb))  (3)

where T is a similarity transform that maps the model space into the image space is used.

In one or more embodiments, mapping can be built from facial feature points, detected by ASM, to Candide-3 point, and that gives us Candide-3 points x and y coordinates. Candide is a parameterised face mask specifically developed for model-based coding of human faces. Its low number of polygons (approximately 100) allows fast reconstruction with moderate computing power. Candide is controlled by global and local Action Units (AUs). The global ones correspond to rotations around three axes. The local Action Units control the mimics of the face so that different expressions can be obtained.

The following equation system can be made, knowing Candide-3 points x and y coordinates.

Σ_(j=1) ^(m) X _(ij) *B _(j) =x _(i),  (4)

Σ_(j=1) ^(m) Y _(ij) =Y _(ij) *B _(j) =y _(i),  (5)

where Bj—j-th shape unit, x_(i), y_(i)—i-th point coordinates, Xij, Yij—coefficients, which denote how the i-th point coordinates are changed by j-th shape unit. In this case, this system is over determined, so it cancan be solved precisely. Thus, the following minimization is made:

(Σ_(j=1) ^(m) X _(ij) *B _(j) −x _(i))²+(Σ_(j=1) ^(m) Y _(ij) *B _(j) −y _(i))²→min.  (6)

Let's denote X=((X _(ij))^(T),(Y _(ij))^(T))^(T) ,x=((x _(i))^(T),(y _(i))^(T))^(T) ,B=(B _(j))^(T).  (7)

This equation system is linear, so it's solution is B=(X ^(T) X)⁻¹ X ^(T) x  (8)

In one or more embodiments, it is also possible to use Viola-Jones method and ASM to improve tracking quality. Face tracking methods usually accumulate error over time, so they can lose face position after several hundred frames. In order to prevent it, in the present invention the ASM algorithm is run from time to time to re-initialize tracking algorithm.

Face Tracking

In one or more embodiments, the next step comprises tracking the detected object in the video stream. In the present invention is used the abovementioned Candide-3 model (see Ahlberg, J.: Candide-3, an updated parameterized face. Technical report, Linkoping University, Sweden (2001)) for tracking face in a video stream. The mesh or mask corresponding to Candide-3 model is shown in FIG. 2 .

In one or more embodiments, a state of the model can be described by shape units intensity vector, action units intensity vector and a position-vector. Shape units are some main parameters of a head and a face, in the present invention next 10 units are used:

-   -   Eyebrows vertical position     -   Eyes vertical position     -   Eyes width     -   Eyes height     -   Eye separation distance     -   Nose vertical position     -   Nose pointing up     -   Mouth vertical position     -   Mouth width     -   Chin width

In one or more embodiments, action units are face parameters that correspond to some face movement, In the present invention next 7 units are used:

-   -   Upper lip raiser     -   Jaw drop     -   Lip stretcher     -   Left brow lowerer     -   Right brow lowerer     -   Lip corner depressor     -   Outer brow raiser

In one or more embodiments, the mask position at a picture can be described using 6 coordinates: yaw, pitch, roll, x, y, scale. The main idea of the algorithm proposed by Dornaika et al. (Dornaika, F., Davoine, F.: On appearance based face and facial action tracking. IEEE Trans. Circuits Syst. Video Technol. 16(9):1107-1124 (2006)) is to find the mask position, which observes the region most likely to be a face. For each position it is possible to calculate observation error—the value which indicates the difference between image under current mask position and the mean face. An example of the mean face and of the observation under current position is illustrated in FIGS. 3(a)-3(b). FIG. 3(b) corresponds to the observation under the mask shown in FIG. 4 .

In one or more embodiments, face is modeled as a picture with a fixed size (width=40px, height=46px) called a mean face. Gaussian distribution that proposed in original algorithms has shown worse result in compare with static image. So the difference between current observation and a mean face is calculated in the following way:

e(b)=Σ(log(1+I _(m))−log(1+I _(i))²  (9)

Logarithm function makes tracking more stable.

In one or more embodiments, to minimize error Taylor series is used as it was proposed by Dornaika at. el (see F. Dornaika, F. Davoine, On appearance based face and facial action tracking, in IEEE Transactions on Circuits and Systems for Video Technology, 16(9), September, 2006, p. 1107-1124). It was found that it is not necessary to sum up a number of finite differences when calculating an approximation to first derivative. Derivative is calculated in the following way:

$\begin{matrix} {g_{ij} = \frac{{W\left( {y_{t},{b_{t} + {\delta b_{t}}}} \right)}_{ij} - {W\left( {y_{t},{b_{t} - {\delta b_{t}}}} \right)}_{ij}}{\delta_{j}}} & (10) \end{matrix}$

Here g_(ij) is an element of matrix G. This matrix has size m*n, where m is large enough (about 1600) and n is small (about 14). In case of straight-forward calculating there have to be done n*m operations of division. To reduce the number of divisions this matrix can be rewritten as a product of two matrices:

G=A*B

Where matrix A has the same size as G and its element is:

a _(ij) =W(y _(t) ,b _(t) +δb _(t))_(ij) −W(y _(t) ,b _(t) −δb _(t))_(ij)  (11)

and matrix B is a diagonal matrix with sizes n*n, and

b _(ii)=δ_(i) ⁻¹

Now Matrix G_(t) ⁺ has to be obtained and here is a place where a number of divisions can be reduced.

G _(t) ⁺=(G ^(T) G)⁻¹ G ^(T)=(B ^(T) A ^(T) AB)⁻¹ B ^(T) A ^(T) =B ⁻¹(A ^(T) A)⁻¹ B ⁻¹ BA ^(T) =B ⁻¹(A ^(T) A)⁻¹ A ^(T)  (12)

After that transformation this can be done with n*n divisions instead of m*n.

One more optimization was used here. If matrix G_(t) ⁺ is created and then multiplied to Δb_(t), it leads to n²m operations, but if first A^(T) and Δb_(t) are multiplied and then B⁻¹(A^(T)A)⁻¹ with it, there will be only n*m+n³ operations, that is much better because n<<m.

Thus, the step of tracking the detected object in the video stream in the present embodiment comprises creating a mesh that is based on the detected feature points of the object and aligning the mesh to the object on each frame.

It should be also noted that to increase tracking speed in the present invention multiplication of matrices is performed in such a way, that it can be boosted using ARM advanced SIMD extensions (also known as NEON). Also, the GPU is used instead of CPU, whenever possible. To get high performance of the GPU, operations in the present invention are grouped in a special way.

Thus, tracking according to the present invention has the following advantageous features:

1. Before tracking, Logarithm is applied to grayscale the value of each pixel to track it. This transformation has a great impact to tracking performance.

2. In the procedure of gradient matrix creation, the step of each parameter depends on the scale of the mask.

Changing of Proportions

In this disclosure, changing of proportions will be described in terms of making the face thinner/thicker. However, it will be appreciated by one skilled in the art that other proportions of the object, for example a human face, can be changed using the method of the present invention.

In the present embodiment of the method, face tracking results and rigid moving least squares (MLS) deformation method are used for deforming some face details.

In one or more embodiments, image deformations are built based on collections of points with which the user controls the deformation. A set of control points is referred to as p and the deformed positions of the control points p are referred to as q. A deformation function f is constructed which satisfies the three properties outlined in the introduction using Moving Least Squares. Given a point v in the image, the best affine transformation I_(v)(x) is needed that minimizes

Σw _(i) |l _(v)(p _(i))−q _(i)|²  (13)

where p_(i) and q_(i) are row vectors and the weights w_(i) have the form

$\begin{matrix} {w_{i} = {\frac{1}{{❘{p_{i} - v}❘}^{2\alpha}}''}} & (14) \end{matrix}$

In one or more embodiments, α=0.9 is chosen for the method. In this embodiment, Rigid Deformations method is chosen. However, it is clear for one skilled in the art that other values and methods can be chosen in another embodiments of the present invention. By this method each point v on the image transforms to the point fr(v).

$\begin{matrix} {{f_{r}(v)} = {{{❘{v - {p*}}❘}\frac{{{\Sigma\left( {q_{i} - q} \right.}\text{*)}}A_{i}}{{{{❘{\Sigma\left( {q_{i} - q} \right.}}\text{*)}}A_{i}}❘}} + {q*}}} & (15) \end{matrix}$

where

$\begin{matrix} \left. {{\left. {{A_{i} = {w_{i}\left( {{p_{i} - {p*}};{- \left( {p_{i} - p} \right.}} \right.}}\text{*)}}^{\bot} \right)^{\top}\left( {{v - {p*}};{- \left( {v - p} \right.}} \right.}\text{*)}}^{\bot} \right) & (16) \end{matrix}$ $\begin{matrix} {\left( {x;y} \right)^{\bot} = \left( {{- y};x} \right)} & (17) \end{matrix}$ $\begin{matrix} {p*=\frac{\Sigma w_{i}p_{i}}{\Sigma w_{i}}} & (18) \end{matrix}$ $\begin{matrix} {q*=\frac{\Sigma w_{i}q_{i}}{\Sigma w_{i}}} & (19) \end{matrix}$ $\begin{matrix} {{❘\left( {x;y} \right)❘} = \sqrt{x^{2} + y^{2}}} & (20) \end{matrix}$

In one or more embodiments, to make calculations faster a square grid is made on the picture and function's values are calculated in its vertices only. Values in all other pixels are calculated approximately, using bilinear interpolation. This square grid is also associated with the background of the object in the video stream and is used to transform the background of the object to avoid the background distortion.

In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two variables (e.g., x and y) on a regular 2D grid.

In one or more embodiments, linear interpolation is performed first in one direction, and then again in the other direction. Although each step is linear in the sampled values and in the position, the interpolation as a whole is not linear but rather quadratic in the sample location (details below).

In one or more embodiments, it is further supposed that the value of the unknown function f at the point P=(x,y) is to be found. It is assumed that the value of f at the four points Q₁₁=(x₁,y₁), Q₁₂=(x₁,y₂), Q₂₁=(x₂,y₁), and Q₂₂=(x₂,y₂) is known.

First linear interpolation in the x-direction is made. This yields

$\begin{matrix} {{f\left( R_{1} \right)} \approx {{\frac{x_{2} - x}{x_{2} - x_{1}}{f\left( Q_{11} \right)}} + {\frac{x - x_{1}}{x_{2} - x_{1}}{f\left( Q_{21} \right)}}}} & (21) \end{matrix}$

where R₁=(x,y₁)R₁=(x,y₁)

$\begin{matrix} {{f\left( R_{2} \right)} \approx {{\frac{x_{2} - x}{x_{2} - x_{1}}{f\left( Q_{12} \right)}} + {\frac{x - x_{1}}{x_{2} - x_{1}}{f\left( Q_{22} \right)}}}} & (22) \end{matrix}$

where R₁=(x,y₂)R₁=(x,Y₂)

Then interpolating in the y-direction is made:

$\begin{matrix} {{f(P)} \approx {{\frac{y_{2} - y}{y_{2} - y_{1}}{f\left( R_{1} \right)}} + {\frac{y - y_{1}}{y_{2} - y_{1}}{f\left( R_{2} \right)}}}} & (23) \end{matrix}$

This gives the desired estimate of f(x,y).

$\begin{matrix} {{f\left( {x,y} \right)} \approx {{\frac{\left( {x_{2} - x} \right)\left( {y_{2} - y} \right)}{\left( {x_{2} - x_{1}} \right)\left( {y_{2} - y_{1}} \right)}{f\left( {x_{1},y_{1}} \right)}} + {\frac{\left( {x - x_{1}} \right)\left( {y_{2} - y} \right)}{\left( {x_{2} - x_{1}} \right)\left( {y_{2} - y_{1}} \right)}{f\left( {x_{2},y_{1}} \right)}} + {\frac{\left( {x_{2} - x} \right)\left( {y_{2} - y} \right)}{\left( {x_{2} - x_{1}} \right)\left( {y_{2} - y_{1}} \right)}{f\left( {x_{1},y_{2}} \right)}} + {\frac{\left( {x - x_{1}} \right)\left( {y_{2} - y} \right)}{\left( {x_{2} - x_{1}} \right)\left( {y_{2} - y_{1}} \right)}{f\left( {x_{2},y_{2}} \right)}}}} & (24) \end{matrix}$

Red pixels as the vertices of the grid are shown in FIG. 5 .

In one or more embodiments, to make calculations faster the values of w_(i) are being pre-calculated for all integer vectors p_(i)-v in the beginning of the program work and real values are not being calculated during algorithm work. They are being taken by the nearest neighbor method.

In one or more embodiments, for each pixel of the resulting point its value is calculated using the next formula:

$\begin{matrix} {c_{u} = \frac{\begin{matrix} \sum_{{{{{❘{{u.x} - {{f_{r}(v)}.x}}❘} < 1}\&}{❘{{u.y} - {{f_{r}(v)}.y}}❘}} < 1} \\ {c_{v}{\left( {1 - {❘{{f_{r}{(v).x}} - {u.x}}❘}} \right) \cdot \left( {1 - {❘{{f_{r}{(v).y}} - {u.y}}❘}} \right)}} \end{matrix}}{\begin{matrix} \sum_{{{{{❘{{u.x} - {{f_{r}(v)}.x}}❘} < 1}\&}{❘{{u.y} - {{f_{r}(v)}.y}}❘}} < 1} \\ {\left( {1 - {❘{{f_{r}{(v).x}} - {u.x}}❘}} \right) \cdot \left( {1 - {❘{{f_{r}{(v).y}} - {u.y}}❘}} \right)} \end{matrix}}} & (25) \end{matrix}$

where u is a point on the resulting image, v is a point on the initial image, c_(u) is a color of pixel u, c_(v) is a color of pixel v. To find all the pixels on the initial image which satisfy the condition

|u·x−f _(r)(v)·x|<1&|u·y−f _(r)(v)·y|<1  (26)

it is not necessary to look through all the pixels. Instead the transformation f_(r) is built and for each point f_(r) (v) the nearest pixels are found:

([f _(r)(v)·x],[f _(r)(v)·y])  (27)

([f _(r)(v)·x]+1,[f _(r)(v)·y])  (28)

([f _(r)(v)·x],[f _(r)(v)·y]+1)  (29)

([f _(r)(v)·x]+1,[f _(r)(v)·y]+1)  (30)

and save two corresponding sums for them:

bufferSums[u]+=c _(v)(1−|f _(r)(v)·x−u·x|)(1−|f _(r)(v)·y−u·y|)  (31)

bufferWeight[u]+=(1−|f _(r)(v)·x−u·x|)(1−|f _(r)(v)·y−u·y|)  (32)

Then the color value in each pixel can be calculated as following:

$\begin{matrix} {c_{u} = \frac{{bufferSums}\lbrack u\rbrack}{{bufferWeight}\lbrack u\rbrack}} & (33) \end{matrix}$

If some resulting points don't have a prototype, their values are calculated using bilinear interpolation on neighbors.

In one or more embodiments, face tracking results are used to choose sets of control points p and q. Some vertices of Candide are projected to the plane and 8 points are added: 4 corner points and 4 middles of borders. This set of points is taken as p. On the FIG. 6 the choice of control points (marked green) is shown.

In one or more embodiments, to obtain set q Deformation units to Candide were introduced. They are some parameters that correspond to the desired deformations. In this embodiment 3 deformation units are added:

-   -   Fatness     -   Nose width     -   Eye width

However, in other embodiments other deformation units can be chosen to implement the desired face deformation.

In one or more embodiments, each of Deformation units influences on some Candide points' positions and it has its current value in each moment of time—the bigger value, the bigger influence. For example, to make a man fatter, Fatness value should be increased and to make him thinner it should be decreased.

Thus, in each moment of time two Candide models with equal values of Shape and Action units are present, but with different values of Deformation units. The first Candide corresponds to the real face form and the second one corresponds to the wanted form. By the second Candide points' projection to the plane set q is obtained. On the FIG. 7 the difference between sets p (green points) and q (corresponding blue points) is shown. Than MLS is used to get transformation of p into q.

Here are values of Deformation units' influence on the chosen points in the described embodiment:

Fatness (8)

-   -   62 0.050000 0.000000 0.000000     -   61 0.100000 0.000000 0.000000     -   63 0.110000 0.000000 0.000000     -   29-0.050000 0.000000 0.000000     -   28-0.100000 0.000000 0.000000     -   30-0.110000 0.000000 0.000000     -   65 0.000000 0.100000 0.000000     -   32 0.000000 0.100000 0.000000

Nose width (4)

-   -   76 0.050000 0.000000 0.000000     -   75-0.050000 0.000000 0.000000     -   78 0.030000 0.000000 0.000000     -   77-0.030000 0.000000 0.000000

Eye width (10)

-   -   52 0.000000 0.030000 0.000000     -   53-0.020000 0.000000 0.000000     -   56 0.020000 0.000000 0.000000     -   57 0.000000-0.030000 0.000000     -   73 0.000000 0.025000 0.000000     -   19 0.000000 0.030000 0.000000     -   20 0.020000 0.000000 0.000000     -   23-0.020000 0.000000 0.000000     -   24 0.000000-0.030000 0.000000     -   0.000000 0.025000 0.000000

Examples of Fatness and Nose width deformations' applying are shown in FIGS. 8(a)-8(c). To make fat deformation more natural mouth is not stretched while making people fatter but mouth is compressed while making people thinner.

Thus, the algorithm has to:

-   -   1. find the Candide position (Shape and Action units)     -   2. apply Deformation units to the second Candide     -   3. project both Candides to obtain sets p and q     -   4. build the deformation using MLS in grid vertices     -   5. calculate deformation in all pixels using bilinear         interpolation     -   6. build resulting picture

In one or more embodiments, to make this effect a real time GPU is used with some optimizations of its functioning. The image is split with regular grid and the transformation is calculated only in its nodes. Then the linear interpolation is used to get transformation at each pixel. With increasing of grid size fps (frames per second) is increased but quality becomes worse.

Thus, changing of the object's proportions in real time in video stream according to the present invention has the following distinguishing features. In the original algorithm the inventors have to compute transformation for each pixel, but on a device it runs slow. To increase speed the inventors divide plane of image with regular grid and compute transformation in grid nodes only. Transformation in other pixels is interpolated.

Further advantages of the described embodiments are given by the fact that the method of real time video stream processing for changing proportions of an object in the video stream can be implemented on mobile devices, for example such as mobile phones, smart phones, tablet computers etc., since the method is not resource-intensive.

Exemplary Computer Platform

FIG. 9 is a block diagram that illustrates an embodiment of a computer system 500 upon which various embodiments of the inventive concepts described herein may be implemented. The system 500 includes a computer platform 501, peripheral devices 502 and network resources 503.

The computer platform 501 may include a data bus 504 or other communication mechanism for communicating information across and among various parts of the computer platform 501, and a processor 505 coupled with bus 504 for processing information and performing other computational and control tasks. Computer platform 501 also includes a volatile storage 506, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 504 for storing various information as well as instructions to be executed by processor 505, including the software application for implementing multifunctional interaction with elements of a list using touch-sensitive devices described above. The volatile storage 506 also may be used for storing temporary variables or other intermediate information during execution of instructions by processor 505. Computer platform 501 may further include a read only memory (ROM or EPROM) 507 or other static storage device coupled to bus 504 for storing static information and instructions for processor 505, such as basic input-output system (BIOS), as well as various system configuration parameters. A persistent storage device 508, such as a magnetic disk, optical disk, or solid-state flash memory device is provided and coupled to bus 504 for storing information and instructions.

Computer platform 501 may be coupled via bus 504 to a touch-sensitive display 509, such as a cathode ray tube (CRT), plasma display, or a liquid crystal display (LCD), for displaying information to a system administrator or user of the computer platform 501. An input device 510, including alphanumeric and other keys, is coupled to bus 504 for communicating information and command selections to processor 505. Another type of user input device is cursor control device 511, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 505 and for controlling cursor movement on touch-sensitive display 509. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane. To detect user's gestures, the display 509 may incorporate a touchscreen interface configured to detect user's tactile events and send information on the detected events to the processor 505 via the bus 504.

An external storage device 512 may be coupled to the computer platform 501 via bus 504 to provide an extra or removable storage capacity for the computer platform 501. In an embodiment of the computer system 500, the external removable storage device 512 may be used to facilitate exchange of data with other computer systems.

The invention is related to the use of computer system 500 for implementing the techniques described herein. In an embodiment, the inventive system may reside on a machine such as computer platform 501. According to one embodiment of the invention, the techniques described herein are performed by computer system 500 in response to processor 505 executing one or more sequences of one or more instructions contained in the volatile memory 506. Such instructions may be read into volatile memory 506 from another computer-readable medium, such as persistent storage device 508. Execution of the sequences of instructions contained in the volatile memory 506 causes processor 505 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.

The term “computer-readable medium” as used herein refers to any medium that participates in providing instructions to processor 505 for execution. The computer-readable medium is just one example of a machine-readable medium, which may carry instructions for implementing any of the methods and/or techniques described herein. Such a medium may take many forms, including but not limited to, non-volatile media and volatile media. Non-volatile media includes, for example, optical or magnetic disks, such as the persistent storage device 508. Volatile media includes dynamic memory, such as volatile storage 506.

Common forms of computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, an EPROM, a FLASH-EPROM, a flash drive, a memory card, any other memory chip or cartridge, or any other medium from which a computer can read.

Various forms of computer readable media may be involved in carrying one or more sequences of one or more instructions to processor 505 for execution. For example, the instructions may initially be carried on a magnetic disk from a remote computer. Alternatively, a remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on the data bus 504. The bus 504 carries the data to the volatile storage 506, from which processor 505 retrieves and executes the instructions. The instructions received by the volatile memory 506 may optionally be stored on persistent storage device 508 either before or after execution by processor 505. The instructions may also be downloaded into the computer platform 501 via Internet using a variety of network data communication protocols well known in the art.

The computer platform 501 also includes a communication interface, such as network interface card 513 coupled to the data bus 504. Communication interface 513 provides a two-way data communication coupling to a network link 514 that is coupled to a local network 515. For example, communication interface 513 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 513 may be a local area network interface card (LAN NIC) to provide a data communication connection to a compatible LAN. Wireless links, such as well-known 802.11a, 802.11b, 802.11g and Bluetooth may also used for network implementation. In any such implementation, communication interface 513 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.

Network link 514 typically provides data communication through one or more networks to other network resources. For example, network link 514 may provide a connection through local network 515 to a host computer 516, or a network storage/server 522. Additionally or alternatively, the network link 514 may connect through gateway/firewall 517 to the wide-area or global network 518, such as an Internet. Thus, the computer platform 501 can access network resources located anywhere on the Internet 518, such as a remote network storage/server 519. On the other hand, the computer platform 501 may also be accessed by clients located anywhere on the local area network 515 and/or the Internet 518. The network clients 520 and 521 may themselves be implemented based on the computer platform similar to the platform 501.

Local network 515 and the Internet 518 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 514 and through communication interface 513, which carry the digital data to and from computer platform 501, are exemplary forms of carrier waves transporting the information.

Computer platform 501 can send messages and receive data, including program code, through the variety of network(s) including Internet 518 and LAN 515, network link 515 and communication interface 513. In the Internet example, when the system 501 acts as a network server, it might transmit a requested code or data for an application program running on client(s) 520 and/or 521 through the Internet 518, gateway/firewall 517, local area network 515 and communication interface 513. Similarly, it may receive code from other network resources.

The received code may be executed by processor 505 as it is received, and/or stored in persistent or volatile storage devices 508 and 506, respectively, or other non-volatile storage for later execution.

Finally, it should be understood that processes and techniques described herein are not inherently related to any particular apparatus and may be implemented by any suitable combination of components. Further, various types of general purpose devices may be used in accordance with the teachings described herein. It may also prove advantageous to construct specialized apparatus to perform the method steps described herein. The present invention has been described in relation to particular examples, which are intended in all respects to be illustrative rather than restrictive. Those skilled in the art will appreciate that many different combinations of hardware, software, and firmware will be suitable for practicing the present invention. For example, the described software may be implemented in a wide variety of programming or scripting languages, such as Assembler, C/C++, Objective-C, perl, shell, PHP, Java, as well as any now known or later developed programming or scripting language.

Moreover, other implementations of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. Various aspects and/or components of the described embodiments may be used singly or in any combination in the systems and methods for real time video stream processing. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims. 

What is claimed is:
 1. A computer implemented method comprising: receiving a video depicting a face; receiving a request for changing a fatness of the face; and causing a first portion of the face to be deformed without stretching a mouth portion of the face in response to determining that the request corresponds to increasing the fatness of the face; and causing the first portion of the face to be deformed together with compressing the mouth portion of the face in response to determining that the request corresponds to decreasing the fatness of the face; and providing the video comprising the deformed first portion of the face.
 2. The computer implemented method of claim 1, further comprising: after receiving the request for changing the fatness of the face: initializing a tracking process to detect the face in the video; and deforming a first portion of the detected face depicted in the video by a first deformation amount, in accordance with the request, while deforming a second portion of the face depicted in the video by a second deformation amount.
 3. The computer implemented method of claim 1, further comprising: detecting feature reference points of the face; tracking the face in the video, wherein the tracking comprises creating a first mesh based on the detected feature reference points of the face and aligning the first mesh to the face in each frame; while tracking the face with the first mesh, transforming a set of pixels within the frames of the video representing a portion of the feature reference points to generate transformed frames of the video; and maintaining the first mesh while the face is present in the frames of the video.
 4. The computer implemented method of claim 3, wherein the feature reference points are at least one of points indicating eyebrows vertical position, eyes vertical position, eyes width, eyes height, eye separation distance, nose vertical position, nose pointing up, mouth vertical position, mouth width, chin width, upper lip raiser, jaw drop, lip stretcher, left brow lowerer, right brow lowerer, lip corner depressor, or outer brow raiser.
 5. The computer implemented method of claim 1, further comprising: associating a square grid with a background of the face in the video; and transforming the background of the face using the square grid to avoid background distortion.
 6. The computer implemented method of claim 1, further comprising: indicating a presence of the face from a list of objects in frames of the video, wherein the list further comprises rules for changing proportions of each object from the list; and generating a request for changing proportions of the face in which presence in frames of the video is indicated.
 7. The computer implemented method of claim 1, further comprising: from time to time, re-initializing a tracking process to detect the face in the video to continue deforming the first portion and a second portion of the face.
 8. The computer implemented method of claim 1, further comprising: defining a frame area of the video to be processed, wherein the frame area to be processed sets a frame area of the video where only proportions of those objects or their parts which are positioned in the frame area to be processed are changed.
 9. The computer implemented method of claim 1, further comprising: randomly selecting the face to be changed in frames of the video and randomly selecting at least one rule for changing proportions of the face out of a list of rules; and generating the request for changing proportions of the randomly selected face based on the randomly selected rules.
 10. The computer implemented method of claim 1, further comprising: applying a transformation function only in vertices of a square grid associated with frames of the video; and after the transformation function is applied only in the vertices, computing values in a collection of pixels using linear interpolation in a first direction based on values of the vertices; and after computing the values in the collection of pixels in the first direction, computing values of the collection of pixels using linear interpolation in a second direction based on the values of the vertices.
 11. The computer implemented method of claim 1, wherein a tracking process for tracking the face comprises an Active Shape Model (ASM).
 12. The computer implemented method of claim 1, further comprising: generating a transformation between a pixel of a frame of the video and a corresponding modified pixel in a second frame of the video, the modified pixel being generated based on the request for changing the fatness of the face; identifying a set of nearby pixels to the pixel of the frame based on the transformation; computing two sums for the set of nearby pixels, a first sum of the two sums being computed by scaling values of the set of nearby pixels by the pixel of the frame, a second sum of the two sums being computed based on the values of the set of nearby pixels; and generating the corresponding modified pixel based on a ratio of the first sum and the second sum.
 13. The computer implemented method of claim 1, further comprising: obtaining grayscale values of each pixel of the face in the video; applying a logarithm to the grayscale values of each pixel of the face in the video; and tracking the face in the video based on the logarithm of the grayscale values.
 14. A system comprising: a processor and a memory, the memory storing instructions executed by the processor for performing operations comprising: receiving a video depicting a face; receiving a request for changing a fatness of the face; and causing a first portion of the face to be deformed without stretching a mouth portion of the face in response to determining that the request corresponds to increasing the fatness of the face; and causing the first portion of the face to be deformed together with compressing the mouth portion of the face in response to determining that the request corresponds to decreasing the fatness of the face; and providing the video comprising the deformed first portion of the face.
 15. The system of claim 14, the operations further comprise: detecting feature reference points of the face; tracking the detected face in the video, wherein the tracking comprises creating a first mesh based on the detected feature reference points of the face and aligning the first mesh to the face in each frame; while tracking the detected face with the first mesh, transforming a set of pixels within the frames of the video representing a portion of the feature reference points to generate transformed frames of the video; and maintaining the first mesh while the face is present in the frames of the video.
 16. The system of claim 15, wherein the feature reference points are at least one of points indicating eyebrows vertical position, eyes vertical position, eyes width, eyes height, eye separation distance, nose vertical position, nose pointing up, mouth vertical position, mouth width, chin width, upper lip raiser, jaw drop, lip stretcher, left brow lowerer, right brow lowerer, lip corner depressor, or outer brow raiser.
 17. The system of claim 14, further comprising operations for: associating a square grid with a background of the face in the video; and transforming the background of the face using the square grid to avoid background distortion.
 18. The system of claim 14, the operations further comprising: generating a transformation between a pixel of a frame of the video and a corresponding modified pixel in a second frame of the video, the modified pixel being generated based on the request for changing the fatness of the face; identifying a set of nearby pixels to the pixel of the frame based on the transformation; computing two sums for the set of nearby pixels, a first sum of the two sums being computed by scaling values of the set of nearby pixels, a second sum of the two sums being computed based on the values of the set of nearby pixels; and generating the corresponding modified pixel based on a ratio of the first sum and the second sum.
 19. A non-transitory computer readable medium comprising non-transitory computer readable instructions that, when executed by one or more processors, configure the one or more processors to perform operations comprising: receiving a video depicting a face; receiving a request for changing a fatness of the face; and causing a first portion of the face to be deformed without stretching a mouth portion of the face in response to determining that the request corresponds to increasing the fatness of the face; and causing the first portion of the face to be deformed together with compressing the mouth portion of the face in response to determining that the request corresponds to decreasing the fatness of the face; and providing the video comprising the deformed first portion of the face.
 20. The non-transitory computer readable medium of claim 19, wherein the operations further comprise: generating a transformation between a pixel of a frame of the video and a corresponding modified pixel in a second frame of the video, the modified pixel being generated based on the request for changing the fatness of the face; identifying a set of nearby pixels to the pixel of the frame based on the transformation; computing two sums for the set of nearby pixels, a first sum of the two sums being computed by scaling values of the set of nearby pixels, a second sum of the two sums being computed based on the values of the set of nearby pixels; and generating the corresponding modified pixel based on a ratio of the first sum and the second sum. 